package com.seveneight.baijiesteward.ui.user.model;

import android.content.Context;
import android.util.Log;
import android.widget.Toast;

import com.alibaba.fastjson.JSON;
import com.seveneight.baijiesteward.bean.AnyBean;
import com.seveneight.baijiesteward.bean.BaseEntity;
import com.seveneight.baijiesteward.http.BaseModel;
import com.seveneight.baijiesteward.http.BaseObserver;
import com.seveneight.baijiesteward.http.HttpConfig;
import com.seveneight.baijiesteward.http.MyCallBack;
import com.seveneight.baijiesteward.http.RetrofitFactory;


import okhttp3.RequestBody;

/**
 * 修改信用卡还款日期
 * Created by user1 on 2018/4/14.
 */

public class UpdateCardDateModel extends BaseModel {
    public void getBankList(Context context, RequestBody body, MyCallBack<AnyBean> myCallBack) {
        RetrofitFactory.getInstence().API().postCardDate(body).
                compose((this.<BaseEntity<AnyBean>>setThread()))
                .subscribe(new BaseObserver<AnyBean>(context) {
                    @Override
                    protected void onSuccees(BaseEntity<AnyBean> t) throws Exception {
                        myCallBack.onSuccess(t.getData());
                    }

                    @Override
                    protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {

                    }
                });

//        RetrofitFactory.getInstence().API()
//                .postCardDate(body)
//                .compose(this.<BaseEntity<AnyBean>>setThread())
//                .subscribe(new BaseObserver<AnyBean>(context) {
//                    @Override
//                    protected void onSuccees(BaseEntity<AnyBean> t) throws Exception {
//                        AnyBean data = JSON.parseObject(JSON.toJSONString(t.getData()), AnyBean.class);
//                        Log.e("xxxxxxxldb",JSON.toJSONString(t.getData()));
//                        myCallBack.onSuccess((data));
//                    }
//
//                    @Override
//                    protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
//
//                    }
//                });
    }
}
